package com.kaikeba.util;

import com.kaikeba.bean.User;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class UserUtil {
    public static String getUsername(HttpSession session){
        return (String) session.getAttribute("adminUserName");
    }
    // TODO : 还没有编写柜子端，未存储任何的录入人信息
    public static String getUserPhone(HttpSession session){
        return "18888888888";
    }
    //得到验证码
    public static String getLoginSms(HttpSession session,String userPhone){
        return (String) session.getAttribute(userPhone);
    }
    //保存验证码到session
    public static void setLoginSms(HttpSession session,String userPhone, String code){
        session.setAttribute(userPhone,code);
    }
    public static void setWxUser(HttpSession session, User user){
        session.setAttribute("wxUser",user);
        System.out.println("存储user到Session中"+user);
    }
    public static User getWxUser(HttpSession session){
        System.out.println("获得user");
        return (User) session.getAttribute("wxUser");

    }
}
